/*
 * Copyright @2010 Dnbiz. All rights reserved.
 */
package com.dnbiz.api.sdk;

/**
 * <pre>
 * Api执行结果
 * </pre>
 * @author HuangFeng(2010-11-25)
 */
public class ApiResult {

	private String apiurl = "";       //API访问参数及URL
	private Object result;            //返回内容对象，失败则返回ApiFail，如果成功则返回String
	private String format = "json";   //格式
	private Flag   flag   = Flag.OK;  //返回状态，成功或失败
	
	public enum Flag
	{
		OK("成功"),
		FAIL("失败");
		
		private String name;

		Flag(String name) {
			this.name = name;
		}
		public String getName() {
			return this.name;
		}
	}
	
	public ApiResult()
	{
		
	}
	
	public ApiResult(String apiurl)
	{
		this.apiurl = apiurl;
	}
	
	public ApiResult(String apiurl, String result)
	{
		this.apiurl = apiurl;
		this.result = result;
	}
	
	public String getApiurl() {
		return apiurl;
	}

	public void setApiurl(String apiurl) {
		this.apiurl = apiurl;
	}

	public Object getResult() {
		return result;
	}

	public void setResult(Object result) {
		this.result = result;
	}

	public String getFormat() {
		return format;
	}

	public void setFormat(String format) {
		this.format = format;
	}
	
	public Flag getFlag() {
		return flag;
	}

	public void setFlag(Flag flag) {
		this.flag = flag;
	}

	
	public String toString() {
		return "ApiResult [flag=" + flag.getName() + ", apiurl=" + apiurl + ", format=" + format
				+ ", result=" + result + "]";
	}
}
